package com.hm.ibsm.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.hm.common.def.MobileDevicesDef;
import com.hm.ibsm.util.BaseDomain;
import com.hm.ibsm.util.R;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * @author shishun.wang
 * @date 2017年2月9日 上午10:37:49
 * @version 1.0
 * @describe 用户授权访问token
 */
@Setter
@Getter
@ToString
@Entity
@Table(name = R.DB.PREFIX + "USER_AUTH_TOKEN")
public class UserAuthTokenDomain extends BaseDomain {

	private static final long serialVersionUID = 1L;

	@Column(name = "user_id", nullable = false)
	private String userId;

	@Column(name = "private_key", nullable = false, length = 2000)
	private String privateKey;

	@Column(name = "public_key", nullable = false, length = 1500)
	private String publicKey;

	@Column(name = "valid_time", nullable = false)
	private long validTime;

	@Enumerated(EnumType.STRING)
	@Column(name = "devices", nullable = false)
	private MobileDevicesDef devices;

	@Column(name = "ip_address", nullable = false)
	private String ipAddress;

	@Column(name = "auth_time", nullable = false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date authTime;

	@Column(name = "login_time", nullable = false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date loginTime;
}
